package com.authine.cloudpivot.ext.applicationservice.v1.sourcing.vo;

import com.authine.mvp.app.launcher.domain.AttachmentFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.List;

/**
 * @ClassName InquiryGoodsClarifyVO
 * @Description: InquiryGoodsClarifyVO
 * @Author fj
 * @Date 2021/5/14
 * @Version V1.0
 **/
@Data
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("澄清记录VO")
public class InquiryGoodsClarifyVO{
    @ApiModelProperty(value = "澄清记录id")
    private String id;
    @ApiModelProperty(value = "询价商品id")
    @JsonProperty("inquiryGoodsId")
    private String inquiry_goods_id;
    @ApiModelProperty(value = "澄清人id")
    @JsonProperty("memberId")
    private String member_id;
    @ApiModelProperty(value = "澄清人名")
    @JsonProperty("memberName")
    private String member_name;
    @ApiModelProperty(value = "澄清内容")
    @JsonProperty("clarifyTips")
    private String clarify_tips;
    @ApiModelProperty(value = "客户id")
    @JsonProperty("customerId")
    private String customer_id;
    @ApiModelProperty(value = "供应商id")
    @JsonProperty("vendorId")
    private String vendor_id;
    @ApiModelProperty(value = "澄清组织名")
    @JsonProperty("organizationName")
    private String organization_name;
    @ApiModelProperty("附件")
    private List<AttachmentFormat> attachment;
    @ApiModelProperty(value = "澄清时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonProperty("time")
    private Date createdTime;

//    public static List<InquiryGoodsClarifyVO> toInquiryGoodsClarifyVO(List<Map<String,Object>> inquiryGoodsClarifyList) {
//        List<InquiryGoodsClarifyVO> list = new ArrayList<>();
//        if (inquiryGoodsClarifyList != null && !inquiryGoodsClarifyList.isEmpty()) {
//            inquiryGoodsClarifyList.forEach(inquiryGoodsClarify -> {
//                list.add(new InquiryGoodsClarifyVO(String.valueOf(inquiryGoodsClarify.get("id")),
//                        String.valueOf(inquiryGoodsClarify.get("inquiry_goods_id")),
//                        inquiryGoodsClarify.get("member_id") == null ? null : (Long)inquiryGoodsClarify.get("member_id"),
//                        String.valueOf(inquiryGoodsClarify.get("member_name")),
//                        String.valueOf(inquiryGoodsClarify.get("clarify_tips")),
//                        inquiryGoodsClarify.get("customer_id") == null ? null : (Long)inquiryGoodsClarify.get("customer_id"),
//                        inquiryGoodsClarify.get("vendor_id") == null ? null : (Long)inquiryGoodsClarify.get("vendor_id"),
//                        String.valueOf(inquiryGoodsClarify.get("organization_name")),
//                        "[]".equals(inquiryGoodsClarify.get("attachment")) ? Lists.newArrayList() : JSONArray.parseArray(JSONArray.toJSONString(inquiryGoodsClarify.get("attachment")), AttachmentFormat.class),
//                        DateUtils.parseDate(String.valueOf(inquiryGoodsClarify.get("createdTime")), "yyyy-MM-dd HH:mm:ss")
//                ));
//            });
//        }
//        return list;
//    }
}
